﻿
@section header{
    <title>配送信息-配送管理</title>
    <link type="text/css" rel="stylesheet" href="/admin_store/css/site.css" />
    <script type="text/javascript" src="/admin_store/scripts/jquery.js"></script>
    <script type="text/javascript" src="/admin_store/scripts/showlist.js"></script>
    <link rel="stylesheet" type="text/css" href="/components/jbox/Skins/Default/jbox.css" />
    <script type="text/javascript" src="/components/jbox/jquery.jBox-2.3.min.js"></script>
    <script type="text/javascript" src="/admin_store/scripts/selectlist.js"></script>
    <script type="text/javascript" src="http://wxpassport.711688.net.cn/files/Scripts/v3/ajax-data.js"></script>
}

@section body{
    <h1 class="rightH1">
        微信小程序 &gt; 餐饮外卖 &gt; <span class="rightH1-cur">配送信息</span>
        <div class="right">
            <div class="clear"></div>
        </div>
        <div class="clear"></div>
    </h1>


    <div class="addTable">
        <table width="100%">
            <tr>
                <td width="80px" align="right">商户配送余额：</td>
                <td>@ViewData["balance"]</td>
            </tr>
        </table>
        <div style="margin-top:100px;">
            <h3>达达配送状态更改（测试环境需要手动触发）</h3>
            <div style="margin-top:15px; margin-bottom:15px;">订单号：<input type="text" id="order_id" /></div>
            <a><button class="button" data-action="TestAccept">达达接单</button></a>
            <a><button class="button" data-action="TestFetch">达达收货</button></a>
            <a><button class="button" data-action="TestFinish">配送完成</button></a>
            <a><button class="button" data-action="TestCacel">取消配送</button></a>
        </div>
    </div>
    <script>

        $(function () {
            $(".button").click(function () {
                submits($(this).attr("data-action"));
            })
        })

        //更新达达订单进度(测试环境模拟)
        function submits(action) {
            var order_id = $("#order_id").val();
            var url = "http://121.199.10.151:8011/api/ship/" + action + "?order_id=" + order_id;
            
            if (order_id == '') {
                $.jBox.tip('请填写订单号！');
                return;
            }
            ajaxGet(url, function (data) {
                if (data.Code != 0) {
                    $.jBox.tip(data.Message);
                    return;
                }
                var ddResult = JSON.parse(data.Data);
                if (ddResult.code != "0") {
                    $.jBox.tip(ddResult.msg);
                    return;
                }

                $.jBox.tip('操作成功！');
            })
        }
    </script>
}